package home_pagePO;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.By;

public class LoginPO {
    //    AndroidDriver driver;
    AppiumDriver driver;

    public LoginPO(AppiumDriver driver) {
        this.driver = driver;
    }

    //协议弹窗
    public static By agreement = By.id("com.ksbao.nursingstaffs:id/btn_right");
    public static By userName_text = By.id("com.ksbao.nursingstaffs:id/et_account");
    public static By pwd_text = By.id("com.ksbao.nursingstaffs:id/et_pwd");
    public static By btn_Login = By.id("com.ksbao.nursingstaffs:id/btn_login");
    //广告关闭
    public static By x = By.id("com.ksbao.nursingstaffs:id/img_btn_cancel");

    public LoginPO hone_Login(String userName, String pwd) throws InterruptedException {
        driver.findElement(agreement).click();
        driver.findElement(userName_text).sendKeys(userName);
        driver.findElement(pwd_text).sendKeys(pwd);
        driver.findElement(btn_Login).click();
        Thread.sleep(500);
        driver.findElement(x).click();
        return new LoginPO(driver);
    }
}
